﻿using Minecraft.Config.ipConst;
using Minecraft.Model.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.ServerHall
{
	public static class MinecraftServerExt
	{
		public static List<IpUserName> GetIpUserNameList(this MinecraftServer server)
		{
			List<IpUserName> ipUserNameList = new List<IpUserName>();
			foreach (var session in server.GetAllSessions())
			{
				ipUserNameList.Add(new IpUserName
				{
					ipAddr = session.RemoteEndPoint.Address.ToString(),
					userName = IpConstConfig.GetIpUserNameTipStr(session.RemoteEndPoint.Address.ToString())
				});
			}
			return ipUserNameList;
		}
	}
}
